<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" >
<!--[if lt IE 9]>
　　　　<script src="http://css3-mediaqueries-js.googlecode.com/svn/trunk/css3-mediaqueries.js"></script>
　　<![endif]-->
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/sytle.css?v=0.2&d=2016-11-08">
<script type="text/javascript" src="${pageContext.request.contextPath}/lib/jquery/1.9.1/jquery.min.js?v=0.1"></script>

<title>地址管理</title>
<style>
*{ background:#f6f6f6;}
</style>
</head>
<script>
function onDefault(id) {
	
	$.ajax({
		  url: "${pageContext.request.contextPath}/members/default/" + id + ".json",
		  success:function(data) {
			  if(data != 0) {
				  window.location.reload();
			  }
		  }
		});
}

function del(id) {
	if(confirm('是否删除该地址?')){
	$.ajax({
		  url: "${pageContext.request.contextPath}/members/removeContact/" + id + ".json",
		  success:function(data) {
			  if(data != 0) {
				  window.location.reload();
			  }
		  }
		});
	}
}
</script>
<body>
<div class="hgj">
<div class="page-all" style=" margin-bottom:0;">
<div class="container">
<!--内容开始-->
<c:forEach items="${CONTACT_LIST}" var="contact">
<div class="add-list">
<div class="a-l-top">
<div class="alt-left"><p>${contact.wCAddress}</p><p>${contact.wCContact}</p><p>${contact.wCTelephone}</p></div>
<div class="alt-right">
<c:if test="${contact.wCDefault == 1}">
<img src="${pageContext.request.contextPath}/images/be-selected-icon.png"/>
</c:if>
<c:if test="${contact.wCDefault == 0}">
<img src="${pageContext.request.contextPath}/images/selected-icon.png"/>
</c:if>
</div>
</div>
</div>
<div class="a-l-foot">
<div class="alf-left"><input type="checkbox" class="moren" name="default" <c:if test="${contact.wCDefault == 1}">checked</c:if> onclick="onDefault(${contact.id})"/>默认地址</div>
<div class="alf-right"><a href="javascript:void()" class="delete" onclick="del(${contact.id})">删除</a></div>
</div>
</div>
</c:forEach>
</div>
</div>
<!--底部-->
<footer>
<div class="mix-btn">
<c:if test="${CONTACT_LIST != NULL}">
<a href="/${BACK_URL}" class="sure-btn">确认选择</a><a href="${pageContext.request.contextPath}/members/addContact.html" class="add-btn">添加新地址</a>
</c:if>
<c:if test="${CONTACT_LIST == NULL}">
<a href="javascript:void(0);" class="sure-btn">确认选择</a><a href="${pageContext.request.contextPath}/members/addContact.html" class="add-btn">添加新地址</a>
</c:if>
</div>
</footer>
</div>
</body>
</html>
